home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 0195.ZIP / WINDOWS.LIB < prev    next >
Text File  |  1984-12-04  |  3KB  |  76 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5.       If your program uses several windows, or if you change the
  6.       window placement often during development, you may want to
  7.       use the following simple procedures.  You just define the
  8.       four co-ordinates of each window as a single constant of
  9.       type "corners" at the beginning of your program.  Then if
  10.       you want to change that window, you just change it once.
  11.  
  12.       The DoFrame procedure creates a frame AROUND a window.  It
  13.       is up to you to make sure that there exists at least one
  14.       space around the window on all sides.  You specify the
  15.       character to be used in the across and down lines.  If the
  16.       across character is the single or double line (#196 or #205),
  17.       the corners will be the appropriate corner characters--other-
  18.       wise, they will be the same as the across character
  19.  
  20. }
  21.  
  22. type
  23.   corners = array[1..4] of byte;
  24.  
  25. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  26. procedure DoWindow(the_Win : corners);
  27. begin
  28.   window(the_Win[1], the_Win[2], the_Win[3], the_Win[4]);
  29.   GotoXY(1,1);
  30. end;
  31. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  32. procedure DoFrame(the_Win : corners ; across, down : char);
  33. var
  34.   FrameCorners : array[1..4] of char;
  35.   N            : byte;
  36. begin
  37.   window(1,1,80,25);
  38.   case across of
  39.     #196 : begin
  40.              FrameCorners[1] := #218;
  41.              FrameCorners[2] := #191;
  42.              FrameCorners[3] := #192;
  43.              FrameCorners[4] := #217;
  44.            end;
  45.     #205: begin
  46.              FrameCorners[1] := #201;
  47.              FrameCorners[2] := #187;
  48.              FrameCorners[3] := #200;
  49.              FrameCorners[4] := #188;
  50.           end;
  51.     else
  52.        for N := 1 to 4 do
  53.          FrameCorners[N] := across;
  54.   end;  {case}
  55.   GotoXY(the_Win[1]-1,the_Win[2]-1); Write(FrameCorners[1]);
  56.   for N := the_Win[1] to the_Win[3] do Write(across);
  57.   Write(FrameCorners[2]);
  58.   for N := the_Win[2] to the_Win[4] do
  59.     begin
  60.       GotoXY(the_Win[3]+1,N);
  61.       write(down);
  62.     end;
  63.   GotoXY(the_Win[3]+1, the_Win[4]+1); Write(FrameCorners[4]);
  64.   for N := the_Win[3] downto the_Win[1] do
  65.     begin
  66.       GotoXY(N,the_Win[4]+1);
  67.       write(across);
  68.     end;
  69.   GotoXY(the_Win[1]-1, the_Win[4]+1); Write(FrameCorners[3]);
  70.   for N := the_Win[4] downto the_Win[2] do
  71.     begin
  72.       GotoXY(the_Win[1]-1,N);
  73.       Write(down);
  74.     end;
  75. end;
  76. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}